using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class LittleRock : EnemyController
{
    // int rockScore = 5;

    // Update is called once per frame
    void Update()
    {
        transform.Translate(direct * Time.deltaTime * 8f, Space.World);
        transform.Rotate(direct * Time.deltaTime * 10f);
    }

    private void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("Bullet"))
        {
            GameManager.score += 5;
            Destroy(other.gameObject);
        }
        else if (other.CompareTag("Player"))
        {
            GameManager.score += 5;
            if (playerControl)
            {
                if (!playerControl.isShield)
                {
                    --playerControl.liveNum;
                    print(playerControl.liveNum);
                    if (playerControl.liveNum <= 0)
                    {

                        GameManager.isActivateGame = false;
                        Destroy(other.gameObject);
                    }
                }
            }
        }
        Destroy(gameObject);
    }
}
